﻿using System;
using System.Collections;
using System.Windows;
using System.Windows.Media;

namespace Amicus_Place_Finder
{
    public static class Helper
    {
        public static void MergeCustomColors()
        {
            var dictionaries = new ResourceDictionary();
            string source = "";
            source = String.Format("/Amicus_Place_Finder;component/Resources/ThemeResources.xaml");
            var themeStyles = new ResourceDictionary { Source = new Uri(source, UriKind.Relative) };
            dictionaries.MergedDictionaries.Add(themeStyles);
            ResourceDictionary appResources = App.Current.Resources;
            foreach (DictionaryEntry entry in dictionaries.MergedDictionaries[0])
            {
                SolidColorBrush colorBrush = entry.Value as SolidColorBrush;
                SolidColorBrush existingBrush = appResources[entry.Key] as SolidColorBrush;
                if (existingBrush != null && colorBrush != null)
                {
                    existingBrush.Color = colorBrush.Color;
                }
            }
        }
    }
}
